package day2.el;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@WebServlet("/day2/el/test")
public class Test extends HttpServlet{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        User u=new User();
        u.setName("阿黄");
        String[]arr={"你","我","他"};
        List<String>li= Arrays.asList("你们","我们","大家");
        Map<String,String> m=new HashMap<>();
        m.put("a1","hello");
        m.put("a2","friday");

        req.setAttribute("user",u);
        req.setAttribute("arr",arr);
        req.setAttribute("list",li);
        req.setAttribute("map",m);
        req.setAttribute("age",2);
        req.getRequestDispatcher("/day2/el/b.jsp").forward(req,resp);
    }
}
